<include file="Public:header" />
	<div class="container">
		<div class="page-header">
			<h4>{:L('CONTACT_DETAILS')}</h4>
		</div>
		<div class="row">
			<div class="tabbable span12">
				<include file="Public:alert" />
				<ul class="nav nav-tabs">
					<li class="active"><a href="#tab1" data-toggle="tab">{:L('BASIC_INFO')}</a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="tab1">
						<table class="table" width="95%" border="0" cellspacing="1" cellpadding="0">
							<thead>
								<tr>
									<td <if condition="C('ismobile') eq 1">colspan="2"<else />colspan="4"</if>>
										<p style="font-size: 14px;">
											<if condition="$contacts['is_deleted'] == 0">
												<a href="{:U('contacts/edit', 'id='.$contacts['contacts_id'])}">{:L('EDITING')}</a> |
												<a href="{:U('contacts/delete', 'id='.$contacts['contacts_id'])}">{:L('DELETE')}</a> | 
												<a href="javascript:void(0)" onclick="javascript:history.go(-1)">{:L('RETURN')}</a>
											<else />
												<a href="javascript:void(0)" onclick="javascript:history.go(-1)">{:L('RETURN')}</a>
											</if>
										</p>
									</td>
								</tr>
							</thead>
							<tr><th <if condition="C('ismobile') eq 1">colspan="2"<else />colspan="4"</if>>{:L('BASIC_INFO')}</th></tr>
							<tr>
								<td class="tdleft" width="15%">{:L('NAME')}</td>
								<td width="35%">{$contacts.name}</td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" width="15%">{:L('RESPECTFULLY')}</td>
								<td with="35%">{$contacts.saltname}</td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('BELONGS TO THE CUSTOMER')}</td>
								<td><a href="{:U('Customer/view', 'id='.$contacts['customer_id'])}">{$contacts.customer_name}</a></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('POSITION')}</td>
								<td>{$contacts.post}</td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('PHONE')}</td>
								<td><if condition="C('ismobile') neq 1 ">{$contacts.telephone}<else /><a href="tel://{$contacts.telephone}">{$contacts.telephone}</a></if></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('EMAIL')}</td>
								<td>{$contacts.email}</td>
							</tr>
							<tr>
								<td class="tdleft" >QQ：</td>
								<td>{$contacts.qq}</td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('POSTCODE')}</td>
								<td>{$contacts.zip_code}</td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('CREATE_TIME')}</td>
								<td><if condition="$contacts.create_time gt 0">{$contacts.create_time|date="Y-m-d H:i",###}</if></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('UPDATE_TIME')}</td>
								<td><if condition="$contacts.update_time gt 0">{$contacts.update_time|date="Y-m-d H:i",###}</if></td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('CONTACT_ADDRESS')}</td>
								<td>{$contacts.address}</td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
							</tr>
							<tr>
								<td class="tdleft" >{:L('REMARK')}</td>
								<td <if condition="C('ismobile') neq 1">colspan="3"</if>>{$contacts.description}</td>
							</tr>
							<tr>
								<td class="tdleft">{:L('QR_CODE_CARD_INFORMATION')}</td>
								<td <if condition="C('ismobile') neq 1">colspan="3"</if> style="color:#005580;">
									<div class="pull-left"><img src="{:U('contacts/qrcode', 'contacts_id='.$contacts['contacts_id'])}"/></div><div class="pull-left">{:L('FUNCTION_DESCRIPTION')}</div>
								</td>
							</tr>
						</table>
					</div>
					<div class="tab-pane" id="tab2">
						<table class="table table-hover">
							<if condition="$contacts.log eq null">
								<tr>
									<th>{:L('THERE_IS_NO_DATA')}</th>
								</tr>
							<else />
								<volist name="contacts.log" id="vo">
									<tr>
										<th>
											<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty> &nbsp; 
											{$vo.create_date|date="Y-m-d  g:i:s a",###} &nbsp; 
											<notempty name="vo.create_date"> &nbsp; </notempty>
											<if condition="C('ismobile') eq 1"><br/></if>
											{$vo.subject}
										</th>
										<th>
											<if condition="$contacts['is_deleted'] neq 1"><a href="javascript:void(0)" rel="{$vo.log_id}" class="edit_log">{:L('EDITING')}</a>&nbsp; <a href="{:U('log/delete','r=RContactsLog&id='.$vo['log_id'])}">{:L('DELETE')}</a></if>
										</th>
									</tr>
									<tr>
										<td colspan="2">
											<if condition="strlen($vo['content']) gt 100">
												<div id="slog_{$vo.log_id}">
												<pre>{$vo.content|msubstr=###,0,100}
												<a class="more" rel="{$vo.log_id}" href="javascript:void(0)">{:L('VIEW_FULL_INFO')}</a></pre>
												</div>
												<div id="llog_{$vo.log_id}" class="hide">
													<pre>{$vo.content}</pre>
												</div>
											<else/>
												<pre>{$vo.content}</pre>
											</if>
										</td>
									</tr>
								</volist>
							</if>
							<if condition="$contacts['is_deleted'] neq 1">
								<tr>
									<td colspan="2">
										<a href="javascript:void(0);" class="add_log">{:L('ADD')}</a>
									</td>
								</tr>
							</if>
						</table>
					</div>
					<div class="tab-pane" id="tab3">
						<table class="table table-hover">
							<if condition="$contacts.file eq null">
								<tr>
									<th>{:L('THERE_IS_NO_DATA')} </th>
								</tr>
							<else /> 
								<tr>
									<th>&nbsp;</th>
									<th>{:L('FILE_NAME')}</th>
									<th>{:L('SIZE')}</th>
									<th>{:L('ADDED_BY')}</th>
									<th>{:L('ADD_TIME')}</th>
								</tr>
								<volist name="contacts.file" id="vo">
									<tr>
										<td>
											<a href="{:U('file/delete', 'id='.$vo['file_id'].'&r=RContactsFile')}" class="del_confirm">{:L('DELETE')}</a>
										</td>
										<td>
											<a target="_blank" href="{$vo.file_path}">{$vo.name}</a>
										</td>
										<td>
											{$vo.size}{:L('BYTE')}
										</td>
										<td>
											<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty>
										</td>
										<td>
											<notempty name="vo.create_date">{$vo.create_date|date="Y-m-d g:i:s a",###}</notempty>
										</td>
									</tr>
								</volist>
							</if>
							<if condition="$contacts['is_deleted'] == 0">
								<tr>
									<td colspan="5">
										<a href="javascript:void(0);" class="add_file">{:L('ADD')}</a>
									</td>
								</tr>
							</if>
						</table>
					</div>
				</div>
			</div>
		</div> <!-- End #tab1 -->
	</div> <!-- End .content-box-content -->						
<div class="hide" id="dialog-file" title="{:L('ADD_ACCESSORY')}">loading...</div>
<div class="hide" id="dialog-log" title="{:L('DIALOG_ADD_LOG')}">loading...</div>
<div class="hide" id="dialog-log-edit" title="{:L('DIALOG_EDIT_LOG')}">loading...</div>
<div class="hide" id="dialog-role-info" title="{:L('DIALOG_USER_INFO')}">loading...</div>
<script type="text/javascript">
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>
$("#dialog-file").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-log").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-log-edit").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$(function(){
	$(".add_file").click(function(){
		$('#dialog-file').dialog('open');
		$('#dialog-file').load('{:U("file/add", "r=RContactsFile&module=contacts&id=".$contacts["contacts_id"])}');
	});
	$(".add_log").click(function(){
		$('#dialog-log').dialog('open');
		$('#dialog-log').load('{:U("log/add", "r=RContactsLog&module=contacts&id=".$contacts["contacts_id"])}');
	});
	$(".edit_log").click(function(){
		$log_id = $(this).attr('rel');
		$('#dialog-log-edit').dialog('open');
		$('#dialog-log-edit').load('{:U("log/edit","id=")}'+$log_id);
	});
	$(".role_info").click(function(){
		$role_id = $(this).attr('rel');
		$('#dialog-role-info').dialog('open');
		$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
	});
	$(".more").click(function(){
		log_id = $(this).attr('rel');
		$('#llog_'+log_id).attr('class','');
		$('#slog_'+log_id).attr('class','hide');
	});
	$('.del_confirm').click(function(){
		if(confirm('{:L("CONFIRM_DELETE")}')){
			return true;
		}else{
			return false;
		}
	});
});
</script>
<include file="Public:footer" />	